#ifndef __BOARD_H
#define __BOARD_H
#include <stdio.h>
#include "project_config.h"
#include "bsp.h"
#include "bsp_gpio.h"



/* 智慧电源控制器 */
#if (BOARD_PCU_EN)
// DO
#define POWER_CTRL_RCK				PB_2	/* 74HC595 各电源使能控制 BOOT1 */
#define POWER_CTRL_SCK				PB_8
#define POWER_CTRL_DATA				PB_9

#define ALARM						PA_12
#define LED_DRIVE					PA_11	/* LED 灯带驱动 */
#define SWITCH						PC_13	/* TAMPER-RTC */


// DI
#define BAT_CTRL					PA_1	/* 主电源状态检测，默认低电平，220V断电高电平 */
#define Power_DECT1					PC_8	/* 220V输出状态检测，输出正常低电平 */
#define Power_DECT2					PC_9
#define Power_DECT3					PA_6
#define Power_DECT4					PA_7
#define Power_DECT5					PA_8

#define MCU_DI1                     PC_6
#define MCU_DI2                     PC_7

#define BL0939_IRQ_PIN              PB_6
#define BL0906_IRQ_PIN              PB_7


// ADC
#define ADC_TC						PA_0	/* ADC123_IN0 PCB温度检测 */
#define ADC_12V						PB_0	/* ADC12_IN8 直流输出电压检测 */
#define ADC_24V						PB_1	/* ADC12_IN9 */
#define Isense_12V_1				PC_3	/* ADC123_IN14 直流输出电流检测 */
#define Isense_12V_2				PC_1	/* ADC123_IN11 */
#define Isense_12V_3				PC_0	/* ADC123_IN10 */
#define Isense_24V					PC_5	/* ADC12_IN15 */
#define Isense_485_VCC1				PC_2	/* ADC123_IN12 */
#define Isense_485_VCC2				PC_4	/* ADC12_IN14 */


// DAC
#define DAC1_PIN					PA_4	/* 0-10V输出控制 */
#define DAC2_PIN					PA_5


// UART
#define UART1_TX_PIN			    PA_9	/* UART1 for RS485(RJ45) */
#define UART1_RX_PIN			    PA_10
#define UART2_TX_PIN			    PA_2	/* UART2 for BL0906 */
#define UART2_RX_PIN			    PA_3
#define UART3_TX_PIN			    PB_10	/* UART3 for BL0939 电能计量 */
#define UART3_RX_PIN			    PB_11
#define UART4_TX_PIN			    PC_10   /* UART4 for RS485 */
#define UART4_RX_PIN			    PC_11
#define UART5_TX_PIN		        PC_12   /* UART5 for BLE */
#define UART5_RX_PIN			    PD_2


// I2C
#define I2C1_SCL					PB_6	/* I2C1 for lis2dh */
#define I2C1_SDA					PB_7


// SPI
#define SPI2_MOSI					PB_15	/* SPI2 for w5500 */
#define SPI2_MISO					PB_14
#define SPI2_SCLK					PB_13
#define SPI2_NSS					PB_12
#define W5500_INT					PB_3
#define W5500_RST					PB_5


#endif


#endif	/* __BOARD_H */

